const env = process.env.NODE_ENV  // 环境参数

// 配置
let MYSQL_CONF
let REDIS_CONF

  // mysql
  MYSQL_CONF = {
    host: 'localhost',
    user: 'root',
    password: '19990612',
    port: '3306',
    database: 'myblog'
}

// redis
REDIS_CONF = {
    port: 6379,
    host: '127.0.0.1'
}


if (env === 'dev') {
    // mysql
    MYSQL_CONF = {
        host: '106.52.13.151',
        user: 'root',
        password: 'newpassword',
        port: '3306',
        database: 'myblog',
        useConnectionPooling: true
    }

    // redis
    REDIS_CONF = {
        port: 6379,
        host: '127.0.0.1'
    }
}

if (env === 'production') {
    // mysql
    MYSQL_CONF = {
        host: 'localhost',
        user: 'root',
        password: 'newpassword',
        port: '3306',
        database: 'myblog',
        useConnectionPooling: true
    }

    // redis
    REDIS_CONF = {
        port: 6379,
        host: '127.0.0.1'
    }
}

module.exports = {
    MYSQL_CONF,
    REDIS_CONF
}